﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrismDialog
{
    public class DetailViewModel : IDialogAware
    {
        public DialogCloseListener RequestClose { get; }

        bool IDialogAware.CanCloseDialog()
        {
            return true;
        }

        void IDialogAware.OnDialogClosed()
        {
            //RequestClose.Invoke();
        }

        void IDialogAware.OnDialogOpened(IDialogParameters parameters)
        {
            string aa = parameters.GetValue<string>("B");
        }

        public DelegateCommand CloseCommand { get; set; }
        public DetailViewModel()
        {
            CloseCommand = new DelegateCommand(OnClose);
        }

        private void OnClose()
        {
            IDialogResult dialogResult = new DialogResult();
            dialogResult.Parameters.Add("A", 111);
            RequestClose.Invoke(dialogResult);
        }
    }
}
